package controller

import (
	"net/http"
	"robot/middleware"
)

func newIndexController() *http.ServeMux {
	mux := http.NewServeMux()
	mux.HandleFunc("/", middleware.CheckAuth(index))
	mux.HandleFunc("/index", index)
	mux.Handle("/static/", http.StripPrefix("/static/", http.FileServer(http.Dir("static"))))
	return mux
}

func index(w http.ResponseWriter, r *http.Request) {
	http.ServeFile(w, r, "static/index.html")
}
